#include <iostream>
#include <string>
#include <map>
#define bin 61 
using namespace std;
//utf-8



void eprepare(char *a){
	for(int i=0;i<=9;i++)
		a[i] = '0'+i;
	for(int i=0;i<26;i++)
		a[i+10] = 'a'+i;
	for(int i=0;i<26;i++)
		a[i+36] = 'A'+i;
	return;
}

map<char,int> a;
void dprepare(){
	for(int i=0;i<=9;i++)
		a['0'+i] = i;
	for(int i=0;i<26;i++)
		a['a'+i] = i+10;
	for(int i=0;i<26;i++)
		a['A'+i] = i+36;
	return;
}


string encrypt(int n,int *plaintext,char *a){
	string res="";
	for(int i=0;i<n;i++){
		int fir,sec,thi;
		thi = plaintext[i]%bin;
		plaintext[i] = (plaintext[i]-thi)/bin;
		sec = plaintext[i]%bin;
		plaintext[i] = (plaintext[i]-sec)/bin;
		fir = plaintext[i]%bin;
		res += a[fir];
		res += a[sec];
		res += a[thi];
	}
	return res;
}


void decrypt(string ciphertext,int *res){
	for(int i=0;i<(ciphertext.length()+1)/3;i++){
		char fir,sec,thi;
		fir = ciphertext[i*3];
		sec = ciphertext[i*3+1];
		thi = ciphertext[i*3+2];
		res[i] = a[fir]*bin*bin+a[sec]*bin+a[thi];
	}
	return;
}
